<template>
    <div>用户列表 {{id}}</div>

</template>

<script>
    export default {
      props: [
        "id"
      ],
      name: "List",
      /*进入路由前执行的*/
      beforeRouteEnter(to,from,next){
        console.log("页面进入前")
        next(vm => {
          vm.getData();
        });
      },
      /*离开路由前执行*/
      beforeRouteLeave(to,from,next){
        console.log("页面离开前")
        next();
      },
      methods: {
        getData: function () {
          this.axios({
            type: 'get',
            url: 'http://localhost:8080/static/data.json'
          }).then(response=>{
            console.log(response);
          }).catch(error=>{
            console.log(error);
          })
        }
      }
    }
</script>

<style scoped>

</style>
